/**
 * 
 */

"use strict";
var defs = defs || {};

defs.Direction = {
	NONE : 0,
	UP : 1,
	RIGHT : 2,
	DOWN : 3,
	LEFT : 4,
	toString : function(number) {
		switch (number) {
		case 0:
			return 'NONE';
		case 1:
			return 'UP';
		case 2:
			return 'RIGHT';
		case 3:
			return 'DOWN';
		case 4:
			return 'LEFT';
		}
		return '';
	}
};

defs.CounterDirection = {
	0 : defs.Direction.NONE,
	1 : defs.Direction.DOWN,
	2 : defs.Direction.LEFT,
	3 : defs.Direction.UP,
	4 : defs.Direction.RIGHT
};

defs.FIELD_WIDTH = 64;
defs.FIELD_HEIGHT = 64;

defs.FieldTypes = {
	NONE : 0,
	GROUND : 'ground',
	RAIL : 'rail',
	MOVABLE : 'movable',
	SIGNAL : 'signal',
	SWITCH : 'switch'
};

defs.RailTypes = {
	cross : [ [ defs.Direction.LEFT, defs.Direction.RIGHT ],
			[ defs.Direction.UP, defs.Direction.DOWN ] ],
	horizontal : [ [ defs.Direction.LEFT, defs.Direction.RIGHT ] ],
	vertical : [ [ defs.Direction.UP, defs.Direction.DOWN ] ],
	curve_lb : [ [ defs.Direction.LEFT, defs.Direction.DOWN ] ],
	curve_lt : [ [ defs.Direction.LEFT, defs.Direction.UP ] ],
	curve_rt : [ [ defs.Direction.RIGHT, defs.Direction.UP ] ],
	curve_rb : [ [ defs.Direction.RIGHT, defs.Direction.DOWN ] ],
	switch_hlb : [ [ defs.Direction.LEFT, defs.Direction.RIGHT ],
			[ defs.Direction.LEFT, defs.Direction.DOWN ] ],
	switch_vlb : [ [ defs.Direction.LEFT, defs.Direction.DOWN ],
			[ defs.Direction.UP, defs.Direction.DOWN ] ],
	switch_hlt : [ [ defs.Direction.LEFT, defs.Direction.RIGHT ],
			[ defs.Direction.UP, defs.Direction.LEFT ] ],
	switch_vrt : [ [ defs.Direction.UP, defs.Direction.RIGHT ],
			[ defs.Direction.UP, defs.Direction.DOWN ] ],
	switch_hrb : [ [ defs.Direction.LEFT, defs.Direction.RIGHT ],
			[ defs.Direction.RIGHT, defs.Direction.DOWN ] ],
	switch_hrt : [ [ defs.Direction.LEFT, defs.Direction.RIGHT ],
			[ defs.Direction.UP, defs.Direction.RIGHT ] ],
	switch_vlt : [ [ defs.Direction.LEFT, defs.Direction.UP ],
			[ defs.Direction.UP, defs.Direction.DOWN ] ],
	switch_vrb : [ [ defs.Direction.DOWN, defs.Direction.RIGHT ],
			[ defs.Direction.UP, defs.Direction.DOWN ] ]
};

defs.MovableAngleByDirection = {
	train : {
		1 /* UP */: 0,
		2 /* RIGHT */: 90,
		3 /* DOWN */: 180,
		4 /* LEFT */: 270
	}
};

defs.SignalAngleByDirection = {
	1 /* UP */: 0,
	2 /* RIGHT */: 90,
	3 /* DOWN */: 180,
	4 /* LEFT */: 270
};
